package rhc.taskSchedule.exception;

import org.apache.commons.lang3.StringUtils;

public class NormalException extends Exception{

	private static final String place="\\{\\}";
	
	public NormalException(){
		super();
	}
	
	public NormalException(String msg){
		super(msg);
	}
	
	public NormalException(String msg,String... args){
		super(format(msg,args));
	}
	
	protected static String format(String msg,String... args){
		if(StringUtils.isEmpty(msg)) {
			return "";
		}
		if(null == args || args.length == 0){
			return msg;
		}
		
		for(String arg:args){
			msg=msg.replaceFirst(place, arg);
		}
		
		return msg;
	}
}
